/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.sentry;

import io.sentry.protocol.SentryId;

import org.jetbrains.annotations.Nullable;

/**
 * Adds additional information about what happened to an event.
 *
 * @since 2021-06-02
 **/
public final class UserFeedback {
    private final SentryId eventId;
    private @Nullable String name;
    private @Nullable String email;
    private @Nullable String comments;

    /**
     * Initializes SentryUserFeedback and sets the required eventId.
     *
     * @param eventId The eventId of the event to which the user feedback is associated.
     */
    public UserFeedback(SentryId eventId) {
        this(eventId, null, null, null);
    }

    /**
     * Initializes SentryUserFeedback and sets the required eventId.
     *
     * @param eventId The eventId of the event to which the user feedback is associated.
     * @param name the name of the user.
     * @param email the email of the user.
     * @param comments comments of the user about what happened.
     */
    public UserFeedback(
        SentryId eventId, @Nullable String name, @Nullable String email, @Nullable String comments) {
        this.eventId = eventId;
        this.name = name;
        this.email = email;
        this.comments = comments;
    }

    /**
     * Gets the eventId of the event to which the user feedback is associated.
     *
     * @return the eventId
     */
    public SentryId getEventId() {
        return eventId;
    }

    /**
     * Gets the name of the user.
     *
     * @return the name.
     */
    public @Nullable String getName() {
        return name;
    }

    /**
     * Sets the name of the user.
     *
     * @param name the name of the user.
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Gets the email of the user.
     *
     * @return the email.
     */
    public @Nullable String getEmail() {
        return email;
    }

    /**
     * Sets the email of the user.
     *
     * @param email the email of the user.
     */
    public void setEmail(@Nullable String email) {
        this.email = email;
    }

    /**
     * Gets comments of the user about what happened.
     *
     * @return the comments
     */
    public @Nullable String getComments() {
        return comments;
    }

    /**
     * Sets comments of the user about what happened.
     *
     * @param comments the comments
     */
    public void setComments(@Nullable String comments) {
        this.comments = comments;
    }

    @Override
    public String toString() {
        return "UserFeedback{"
            + "eventId="
            + eventId
            + ", name='"
            + name
            + '\''
            + ", email='"
            + email
            + '\''
            + ", comments='"
            + comments
            + '\''
            + '}';
    }
}
